﻿<%@ Page Language="C#" MasterPageFile="~/Shared/Masters/List.master" AutoEventWireup="true" Theme ="Default"
    CodeFile="PerfApply.aspx.cs" Inherits="Modules_Personal_PerfApply" Title="Untitled Page" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register TagPrefix="web" TagName="listtitle" Src="~/Shared/UserControls/ListTitle.ascx" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Assembly="YYControls" Namespace="YYControls" TagPrefix="yyc" %>
<asp:Content ContentPlaceHolderID="idList" ID="idListContent" runat="server">
<script language="javascript" type="text/javascript">
    function selectAll()
    {
        var a = document.getElementsByTagName("input");
        var all = document.getElementById("alls");
        for (var i=0; i<a.length; i++)
        {
            if(all.checked)
            {
                if (a[i].type == "checkbox") 
                {
                    a[i].checked = true;
                }
            }
            else
            {
                if (a[i].type == "checkbox") 
                {
                    a[i].checked = false;
                }
            }
        }
    }
    function cancelAll()
    {
        var a = document.getElementsByTagName("input");
        for (var i=0; i<a.length; i++)
        {
            if (a[i].type == "checkbox") 
            {
                a[i].checked = false;
            }
        }
    }
</script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="crumb">
        <asp:Label runat="server" ID="lblTitle" Text="绩效呈批"></asp:Label>
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <contenttemplate><div id="searchContainer" runat="server">
        <div class="search" id="search">
        <table cellpadding="2" cellspacing="0" class="rtm_shb_b">
            <tr>
                <td style="width:50px">
                    <asp:Label runat="server" ID="lblPost" Text="人员："></asp:Label>
                </td>
                <td style="width:125px;">
                    <asp:TextBox ID="txtTargetUserName" runat="server" Width="120"></asp:TextBox>
                </td>
                <td style="width:50px;"><asp:Label ID="lblTargetOwner" runat="server" Text="指标套："></asp:Label></td>
                <td style="width:125px;">
                    <asp:DropDownList ID="ddlSearchTo" runat="server"></asp:DropDownList>
                </td>
              <%--  <td style="width:50px;"><asp:Label ID="Label1" runat="server" Text="状态："></asp:Label></td>
                <td style="width:125px;">
                    <asp:DropDownList ID="ddlSearchStatus" runat="server"></asp:DropDownList>
                </td>--%>
                <td class="rtm_shb_btn" style="white-space: nowrap">
                    <asp:Button ID="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click"></asp:Button>&nbsp;
                    <asp:Button ID="ResetLinkButton" runat="server" Text="重置" OnClientClick="reset();return false;">
                    </asp:Button>
                </td>
            </tr>
        </table>
    </div>
    <div class="toolbar" id="toolbar">
        <span style="font-weight:bold;height:30px;"><h2>
            <web:listtitle ID="Listtitle1" runat="server" Title="绩效得分呈批" />
        </h2></span>
        <asp:LinkButton ID="btnCreate" runat="server" OnClientClick="return openEditor(this, 'add');" OnClick="CreateButton_Click">
            <asp:Label ID="lblCreatNew" runat="server" Text="">
                <img runat="server" id="imgNew" src="../../Images/icon_new.gif" style="border: 0px" />呈批</asp:Label>
        </asp:LinkButton>
    </div></div>
    <yyc:SmartGridView ID="gvEvaluateList" runat="server" AutoGenerateColumns="False" AllowSorting="True" OnSorting="gvEvaluateList_Sorting" OnRowCommand="gvEvaluateList_RowCommand" OnRowDataBound="gvEvaluateList_RowDataBound"
        EmptyDataText="没有找到数据!">
        <FixRowColumn FixRowType="Header,Pager" FixColumns="0,1"></FixRowColumn>

        <Columns>
         <asp:TemplateField>
                <HeaderTemplate>
                    <div><input type="checkbox" id="alls" name="all" onclick="selectAll()" /></div>
                </HeaderTemplate>
                <ItemTemplate>
                    <input type="checkbox" name="chkSelected" id="chkSelected" runat="server" _class="evalId"
                        value='<%# DataBinder.Eval(Container.DataItem,"ID") %>' />
                </ItemTemplate>
                <controlstyle forecolor="Black" />
                <headerstyle wrap="False" horizontalalign="Center" />
                <itemstyle horizontalalign="Center" forecolor="Black" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="操作">
                <itemtemplate>
                    <table width="46px" style="text-align: left">                    
                        <tr>
                            <td style="border: 0px solid #fff;">
                                <asp:ImageButton runat="server" CommandName="view" CommandArgument='<%# Eval("ID") %>' _ID='<%# Eval("ID") %>' OnClientClick="return view(this,'');" CausesValidation="False"  ImageUrl="~/Images/icon_srh.gif" ToolTip="查看详细" ID="ibtnView" ></asp:ImageButton>
                            </td>
                        </tr>
                    </table>
</itemtemplate>
                <controlstyle forecolor="Black" />
                <headerstyle wrap="False" horizontalalign="Center" />
                <itemstyle horizontalalign="Center" forecolor="Black" />
            </asp:TemplateField>
            <asp:BoundField DataField="User_ID" HeaderText="评分人" SortExpression="User_ID" />
            <asp:BoundField DataField="Target_User_ID" HeaderText="被考核人" SortExpression="Target_User_ID" />
            <asp:BoundField DataField="TargetOwner_ID" HeaderText="指标套" SortExpression="TargetOwner_ID" />
            <asp:BoundField DataField="ID" HeaderText="得分" />
            <asp:BoundField DataField="Create_Time" HeaderText="录入日期" SortExpression="Create_Time" />
          <%--  <asp:BoundField DataField="Status" HeaderText="状态" SortExpression="Status" />--%>
        </Columns>
        <FixRowColumn FixRowType="Header,Pager" FixColumns="" />
    </yyc:SmartGridView>
    <webdiyer:AspNetPager ID="AspNetPager" CssClass="aspNetPager" ShowBoxThreshold="1" OnPageChanged="AspNetPager_PageChanged"
        runat="server" HorizontalAlign="Right" PageSize="20" AlwaysShow="True" FirstPageText="首页"
        LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" Width="98%" CustomInfoClass="aspNetPager"
        LayoutType="Div" PageIndexBoxType="TextBox" ShowPageIndexBox="Auto">
    </webdiyer:AspNetPager>
     </contenttemplate>
    </asp:UpdatePanel>
    
    <script type="text/javascript">
        function openEditor(_this, action) {
            var url = "PerfApplyAdd.aspx";
            
            var evalIds = "";
            var a = document.getElementsByTagName("input");
            for (var i=0; i<a.length; i++)
            {
                if (a[i].getAttribute("_class") == "evalId" && a[i].type == "checkbox" && a[i].checked == true) 
                {
                    evalIds = evalIds + a[i].value + ",";
                }
            }
            evalIds = evalIds.length > 0 ? evalIds.substring(0, evalIds.length - 1) : evalIds;
            if(evalIds == "") {
                alert("请选择要呈批的记录");
                return false;
            }
            url = url + "?evalIds=" + evalIds;
            
            return default_openEditor(url, _this, action, 750, 300,true);
        } 
        
        function view(_this, action) {
            var url = "PerfApplyView.aspx";
            
            return default_openEditor(url, _this, action, 750, 450,true);
        }
        
    </script>

</asp:Content>
